Answer:

               
flour >= 4  true

sugar >= 2  false 

Logical Operators

Examine this part of the program:

// check that there are enough of both ingredients
if ( flour >= 4 && sugar >= 2 )
  System.out.println("Enough for cookies!" );
else
  System.out.println("sorry...." );

For you to have enough ingredients, both relational expressions must be true. This is the role of the && (and-operator) between the two relational expressions. The && requires that both

flour >= 4 

and

sugar >= 2 

are true before the entire expression is true. The entire question must be true in order for the true branch to execute.

The and-operator && is a logical operator. A logical logical operator examines two true and false values and outputs a single true or false value.

QUESTION 4:

Look at the program. What is printed if the user enters 6 for flour and 4 for sugar?